package com.firewolf.hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.Test;

public class MainDriver {
	
	@Test
	public void testSimple(){
		initSessionFactory("simple.cfg.xml");
	}
	
	private SessionFactory initSessionFactory(String cfgFile){
		Configuration cfg = new Configuration().configure(cfgFile);
		ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry();
		return cfg.buildSessionFactory(registry);
	}
}
